﻿#include "lvgl_laohuangli.h"
#include "lvgl_Project.h"
#include "lvgl_laohuangli_anim.h"


LV_IMG_DECLARE(img_laohuangli_1)
LV_IMG_DECLARE(img_laohuangli_2)
LV_IMG_DECLARE(img_laohuangli_3)
LV_IMG_DECLARE(img_laohuangli_4)
LV_IMG_DECLARE(img_laohuangli_5)
LV_IMG_DECLARE(img_laohuangli_6)

_lvgl_laohuangli_data lvgl_laohuangli_data;

void lvgl_laohuangli_taskcb(lv_task_t *t)
{
	static int time = 0;
#if USE_WIN
	if(system_data.huoqu_laohuangli_flag == true && lvgl_refresh_get_sta() == lvgl_refresh_Zhong)
	{
		if (++time > 2)
		{
			time = 0;
			lvgl_refresh_close();
		}
	}
#endif
}

void lvgl_laohuangli_close_task_cb(lv_task_t* t)
{
    static uint8_t cnt = 0;
    if (lvgl_laohuangli_data.close_flag == true)
    {

        if (++cnt >= lvgl_laohuangli_data.close_count)
        {
            cnt = 0;
            lvgl_laohuangli_data.close_flag = false;
            lvgl_task_delete(&lvgl_laohuangli_data.close_task);

			if(lvgl_laohuangli_data.close_num == 0)
			{
				lvgl_laohuangli_DongHua_Chu();
				lvgl_laohuangli_anim_out_start(0,0);

			}

        }

    }

}



//设置农历
void lvgl_laohuangli_Set_YinLi(char *str)
{
	if (str == NULL)
	{

		lv_label_set_text(lvgl_laohuangli_data.label1, "---------");
		return;
	}

	lv_label_set_text(lvgl_laohuangli_data.label1, str);
}

//设置阳历
void lvgl_laohuangli_Set_YangLi(char *str)
{
	if (str == NULL)
	{

		lv_label_set_text(lvgl_laohuangli_data.label2, " ");
		return;
	}

	lv_label_set_text(lvgl_laohuangli_data.label2, str);
}

//设置冲煞
void lvgl_laohuangli_Set_ChongSha(char *str)
{
	if (str == NULL)
	{

		lv_label_set_text(lvgl_laohuangli_data.label3, "---------");
		return;
	}

	lv_label_set_text(lvgl_laohuangli_data.label3, str);
}

//设置五行
void lvgl_laohuangli_Set_WuXing(char *str)
{
	if (str==NULL)
	{
		lv_label_set_text(lvgl_laohuangli_data.label4, "---------");
		return;
	}
	lv_label_set_text(lvgl_laohuangli_data.label4, str);

}

//设置宜
void lvgl_laohuangli_Set_Yi(char *str)
{
	if (str == NULL)
	{

		lv_label_set_text(lvgl_laohuangli_data.label5, "---------");
		return;
	}

	lv_label_set_text(lvgl_laohuangli_data.label5, str);
}


//设置忌
void lvgl_laohuangli_Set_Ji(char *str)
{
	if (str == NULL)
	{

		lv_label_set_text(lvgl_laohuangli_data.label6, "---------");
		return;
	}

	lv_label_set_text(lvgl_laohuangli_data.label6, str);
}


//设置吉神宜趋
void lvgl_laohuangli_Set_JiShenYiQu(char *str)
{
	if (str == NULL)
	{

		lv_label_set_text(lvgl_laohuangli_data.label7, "---------");
		return;
	}

	lv_label_set_text(lvgl_laohuangli_data.label7, str);
}

//设置凶神宜忌
void lvgl_laohuangli_Set_XiongShenYiJi(char *str)
{
	if (str == NULL)
	{

		lv_label_set_text(lvgl_laohuangli_data.label8, "---------");
		return;
	}

	lv_label_set_text(lvgl_laohuangli_data.label8, str);
}

void lvgl_laohuangli_event_cb(struct _lv_obj_t * obj, lv_event_t event)
{

	//printf("cb:%d", event);
	switch (event)
	{
		case LV_EVENT_KEY:

			switch (*(const uint32_t*)lv_event_get_data())
			{
			case LV_KEY_UP:
				lvgl_laohuangli_debug("LV_KEY_UP");

				break;
			case LV_KEY_DOWN:
				lvgl_laohuangli_debug("LV_KEY_DOWN");

				break;
			case LV_KEY_LEFT:
				lvgl_laohuangli_debug("LV_KEY_LEFT");
				if (lvgl_laohuangli_data.refresh_Sta == lvgl_refresh_Zhong)
				{
					break;
				}
				if(lvgl_laohuangli_data.roll_win_num == 1)
				{
					lvgl_laohuangli_data.roll_win_num =0;
					lvgl_laohuangli_anim_roll_win_start(0);
				}
				break;
			case LV_KEY_RIGHT:
				lvgl_laohuangli_debug("LV_KEY_RIGHT");

				if (lvgl_laohuangli_data.refresh_Sta == lvgl_refresh_Zhong)
				{
					break;
				}
				if(lvgl_laohuangli_data.roll_win_num == 0)
				{
					lvgl_laohuangli_data.roll_win_num =1;
					lvgl_laohuangli_anim_roll_win_start(-(110));
				}


				break;
			case LV_KEY_ESC:
				lvgl_laohuangli_debug("LV_KEY_ESC");

				if (lvgl_laohuangli_data.refresh_flag == true)
				{
					break;
				}

				lvgl_laohuangli_data.close_flag = true;
				lvgl_laohuangli_data.close_count = 1;
				lvgl_laohuangli_data.close_num = 0;
				lvgl_task_create(&lvgl_laohuangli_data.close_task, lvgl_laohuangli_close_task_cb, 10, LV_TASK_PRIO_HIGH, NULL);

				break;
			case LV_KEY_DEL:
				lvgl_laohuangli_debug("LV_KEY_DEL");

				break;
			case LV_KEY_BACKSPACE:
				lvgl_laohuangli_debug("LV_KEY_BACKSPACE");

				break;
			case LV_KEY_ENTER:
				lvgl_laohuangli_debug("LV_KEY_ENTER");

				if (lvgl_laohuangli_data.refresh_flag == false)
				{
					lvgl_laohuangli_data.refresh_flag = true;
					lvgl_laohuangli_shuaXin_kaishi();
				}
				break;
			case LV_KEY_NEXT:
				lvgl_laohuangli_debug("LV_KEY_NEXT");

				break;
			case LV_KEY_PREV:
				lvgl_laohuangli_debug("LV_KEY_PREV");

				break;
			case LV_KEY_HOME:
				lvgl_laohuangli_debug("LV_KEY_HOME");

				break;
			case LV_KEY_END:
				lvgl_laohuangli_debug("LV_KEY_END");

				break;
			}
		break;
		case CZ_EVENT_REFRESH_OVER:

			lvgl_laohuangli_ShuaXin_jieshu();
		break;
        case CZ_EVENT_ANIM_IN_READY:

            if (lvgl_laohuangli_data.refresh_first_flag == false)
            {
                lvgl_laohuangli_data.refresh_first_flag = true;
                uint32_t user_data = LV_KEY_ENTER;
                lvgl_send_event(&lvgl_laohuangli_data.cont_main,LV_EVENT_KEY,&user_data);
            }


        break;
		case LV_EVENT_DELETE:

			lvgl_laohuangli_data.cont_main = NULL;
			lvgl_laohuangli_debug("删除窗口");
		break;
		case LV_EVENT_PRESSING://对象被持续按下


		break;
		case LV_EVENT_PRESSED://对象已被按下


		break;
		case LV_EVENT_DRAG_END://拖动结束后

			if (lv_obj_get_x(lvgl_laohuangli_data.cont_main) != 0)
			{
				if (lv_obj_get_x(lvgl_laohuangli_data.cont_main) > 50)
				{
					lvgl_laohuangli_close();
				}
				else
				{
					lv_obj_set_x(lvgl_laohuangli_data.cont_main, 0);
				}
			}
			break;
		break;

	case LV_EVENT_RELEASED://按钮释放

	case LV_EVENT_LONG_PRESSED://按钮长按

		break;




	default:
		break;

	}
}


void lvgl_laohuangli_create(lv_obj_t * parent)
{
	lvgl_laohuangli_debug("ready create");
	lvgl_laohuangli_data.roll_win_num = 0;
	lvgl_laohuangli_data.refresh_Sta = lvgl_refresh_JieShu;
    lvgl_laohuangli_data.refresh_flag = false;
	if (lvgl_laohuangli_data.cont_main == NULL)
	{

		//----创建容器----//
		lvgl_laohuangli_data.cont_main = lv_cont_create(parent, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.cont_main, 0, -(lv_obj_get_height(parent)));
		lv_obj_set_size(lvgl_laohuangli_data.cont_main, lv_obj_get_width(parent),lv_obj_get_height(parent)*2);

		lv_obj_set_click(lvgl_laohuangli_data.cont_main, true); //启用 / 禁用可点击
		lv_obj_set_drag(lvgl_laohuangli_data.cont_main, true);//启用/禁用对象可拖动
		lv_obj_set_drag_dir(lvgl_laohuangli_data.cont_main, LV_DRAG_DIR_ONE);//设置拖动方向
		//lv_obj_set_drag_throw(lvgl_laohuangli_data.cont_main, true);//启用/禁用拖动后是否有惯性移动
		//lv_obj_set_drag_parent(lvgl_laohuangli_data.cont_main, true); //启用 / 禁用父对象可拖动

		lv_obj_add_style(lvgl_laohuangli_data.cont_main, LV_OBJ_PART_MAIN, &lvgl_style.cont_no_border);//设置样式
		lv_obj_set_event_cb(lvgl_laohuangli_data.cont_main, lvgl_laohuangli_event_cb);//设置回调函数

		lvgl_laohuangli_data.cont_roll = lv_cont_create(lvgl_laohuangli_data.cont_main, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.cont_roll, 0, 0);
		lv_obj_set_size(lvgl_laohuangli_data.cont_roll, lv_obj_get_width(lvgl_laohuangli_data.cont_main),300);
		lv_obj_add_style(lvgl_laohuangli_data.cont_roll, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);//设置样式
		lv_obj_move_background(lvgl_laohuangli_data.cont_roll);

		lvgl_laohuangli_data.cont_shade = lv_cont_create(lvgl_laohuangli_data.cont_main, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.cont_shade, 0, 0);
		lv_obj_set_size(lvgl_laohuangli_data.cont_shade, lv_obj_get_width(lvgl_laohuangli_data.cont_main),60);
		lv_obj_add_style(lvgl_laohuangli_data.cont_shade, LV_OBJ_PART_MAIN, &lvgl_style.cont_no_border);//设置样式

		//----五行----//
		lvgl_laohuangli_data.WuXing_cont = lv_cont_create(lvgl_laohuangli_data.cont_roll, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.WuXing_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main), 62);
		lv_obj_set_size(lvgl_laohuangli_data.WuXing_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main),30);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.WuXing_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.WuXing_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);

		lvgl_laohuangli_data.image4 = lv_img_create(lvgl_laohuangli_data.WuXing_cont, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.image4, 17, 0);
		lv_img_set_src(lvgl_laohuangli_data.image4, &img_laohuangli_1);

		lvgl_laohuangli_data.label4 = lv_label_create(lvgl_laohuangli_data.WuXing_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label4, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label4, 61, 2);
		lv_obj_set_width(lvgl_laohuangli_data.label4, lv_obj_get_width(lvgl_laohuangli_data.cont_main)-61);
		lv_obj_set_height(lvgl_laohuangli_data.label4, 24);
		lv_label_set_recolor(lvgl_laohuangli_data.label4, true);
		lv_label_set_align(lvgl_laohuangli_data.label4, LV_LABEL_ALIGN_LEFT);
		lv_label_set_recolor(lvgl_laohuangli_data.label4, true);
		lv_label_set_text(lvgl_laohuangli_data.label4, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label4, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_16_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label4, 20);
		//----五行----//

		//----冲煞----//
		lvgl_laohuangli_data.ChongSha_cont = lv_cont_create(lvgl_laohuangli_data.cont_roll, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.ChongSha_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main), 98);
		lv_obj_set_size(lvgl_laohuangli_data.ChongSha_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main),30);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.ChongSha_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.ChongSha_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);

		lvgl_laohuangli_data.image3 = lv_img_create(lvgl_laohuangli_data.ChongSha_cont, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.image3, 17, 0);
		lv_img_set_src(lvgl_laohuangli_data.image3, &img_laohuangli_2);

		lvgl_laohuangli_data.label3 = lv_label_create(lvgl_laohuangli_data.ChongSha_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label3, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label3, 61, 2);
		lv_obj_set_width(lvgl_laohuangli_data.label3, lv_obj_get_width(lvgl_laohuangli_data.cont_main)-61);
		lv_obj_set_height(lvgl_laohuangli_data.label3, 24);
		lv_label_set_recolor(lvgl_laohuangli_data.label3, true);
		lv_label_set_align(lvgl_laohuangli_data.label3, LV_LABEL_ALIGN_LEFT);
		lv_label_set_recolor(lvgl_laohuangli_data.label3, true);
		lv_label_set_text(lvgl_laohuangli_data.label3, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label3, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_16_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label3, 20);
		//----冲煞----//


		//----宜----//
		lvgl_laohuangli_data.Yi_cont = lv_cont_create(lvgl_laohuangli_data.cont_roll, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.Yi_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main), 134);
		lv_obj_set_size(lvgl_laohuangli_data.Yi_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main),30);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.Yi_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.Yi_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);

		lvgl_laohuangli_data.image5 = lv_img_create(lvgl_laohuangli_data.Yi_cont, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.image5, 17, 0);
		lv_img_set_src(lvgl_laohuangli_data.image5, &img_laohuangli_3);

		lvgl_laohuangli_data.label5 = lv_label_create(lvgl_laohuangli_data.Yi_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label5, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label5, 61, 2);
		lv_obj_set_width(lvgl_laohuangli_data.label5, lv_obj_get_width(lvgl_laohuangli_data.cont_main)-61);
		lv_obj_set_height(lvgl_laohuangli_data.label5, 24);
		lv_label_set_recolor(lvgl_laohuangli_data.label5, true);
		lv_label_set_align(lvgl_laohuangli_data.label5, LV_LABEL_ALIGN_LEFT);
		lv_label_set_recolor(lvgl_laohuangli_data.label5, true);
		lv_label_set_text(lvgl_laohuangli_data.label5, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label5, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_16_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label5, 20);
		//----宜----//

		//----忌----//
		lvgl_laohuangli_data.Ji_cont = lv_cont_create(lvgl_laohuangli_data.cont_roll, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.Ji_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main), 170);
		lv_obj_set_size(lvgl_laohuangli_data.Ji_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main),30);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.Ji_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.Ji_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);

		lvgl_laohuangli_data.image6 = lv_img_create(lvgl_laohuangli_data.Ji_cont, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.image6, 17, 0);
		lv_img_set_src(lvgl_laohuangli_data.image6, &img_laohuangli_4);

		lvgl_laohuangli_data.label6 = lv_label_create(lvgl_laohuangli_data.Ji_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label6, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label6, 61, 2);
		lv_obj_set_width(lvgl_laohuangli_data.label6, lv_obj_get_width(lvgl_laohuangli_data.cont_main)-61);
		lv_obj_set_height(lvgl_laohuangli_data.label6, 24);
		lv_label_set_recolor(lvgl_laohuangli_data.label6, true);
		lv_label_set_align(lvgl_laohuangli_data.label6, LV_LABEL_ALIGN_LEFT);
		lv_label_set_recolor(lvgl_laohuangli_data.label6, true);
		lv_label_set_text(lvgl_laohuangli_data.label6, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label6, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_16_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label6, 20);
		//----忌----//

		//----吉神宜趋----//
		lvgl_laohuangli_data.JiShenYiQu_cont = lv_cont_create(lvgl_laohuangli_data.cont_roll, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.JiShenYiQu_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main), 207);
		lv_obj_set_size(lvgl_laohuangli_data.JiShenYiQu_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main),30);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.JiShenYiQu_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.JiShenYiQu_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);

		lvgl_laohuangli_data.image7 = lv_img_create(lvgl_laohuangli_data.JiShenYiQu_cont, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.image7, 2, 3);
		lv_img_set_src(lvgl_laohuangli_data.image7, &img_laohuangli_5);

		lvgl_laohuangli_data.label7 = lv_label_create(lvgl_laohuangli_data.JiShenYiQu_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label7, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label7, 61, 2);
		lv_obj_set_width(lvgl_laohuangli_data.label7, lv_obj_get_width(lvgl_laohuangli_data.cont_main)-61);
		lv_obj_set_height(lvgl_laohuangli_data.label7, 24);
		lv_label_set_recolor(lvgl_laohuangli_data.label7, true);
		lv_label_set_align(lvgl_laohuangli_data.label7, LV_LABEL_ALIGN_LEFT);
		lv_label_set_recolor(lvgl_laohuangli_data.label7, true);
		lv_label_set_text(lvgl_laohuangli_data.label7, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label7, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_16_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label7, 20);
		//----吉神宜趋----//



		//----凶神宜忌----//
		lvgl_laohuangli_data.XiongShenYiJi_cont = lv_cont_create(lvgl_laohuangli_data.cont_roll, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.XiongShenYiJi_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main), 245);
		lv_obj_set_size(lvgl_laohuangli_data.XiongShenYiJi_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main),30);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.XiongShenYiJi_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.XiongShenYiJi_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);

		lvgl_laohuangli_data.image8 = lv_img_create(lvgl_laohuangli_data.XiongShenYiJi_cont, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.image8, 2, 3);
		lv_img_set_src(lvgl_laohuangli_data.image8, &img_laohuangli_6);

		lvgl_laohuangli_data.label8 = lv_label_create(lvgl_laohuangli_data.XiongShenYiJi_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label8, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label8, 61, 2);
		lv_obj_set_width(lvgl_laohuangli_data.label8, lv_obj_get_width(lvgl_laohuangli_data.cont_main)-61);
		lv_obj_set_height(lvgl_laohuangli_data.label8, 24);
		lv_label_set_recolor(lvgl_laohuangli_data.label8, true);
		lv_label_set_align(lvgl_laohuangli_data.label8, LV_LABEL_ALIGN_LEFT);
		lv_label_set_recolor(lvgl_laohuangli_data.label8, true);
		lv_label_set_text(lvgl_laohuangli_data.label8, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label8, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_16_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label8, 20);
		//----凶神宜忌----//

		//----农历----//
		lvgl_laohuangli_data.NongLi_cont = lv_cont_create(lvgl_laohuangli_data.cont_main, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.NongLi_cont, 0, 7);
		lv_obj_set_size(lvgl_laohuangli_data.NongLi_cont, lv_obj_get_width(lvgl_laohuangli_data.cont_main), 32);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.NongLi_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.NongLi_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);
		lv_obj_align(lvgl_laohuangli_data.NongLi_cont, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);

		lvgl_laohuangli_data.label1 = lv_label_create(lvgl_laohuangli_data.NongLi_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label1, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label1, 0, 0);
		lv_obj_set_width(lvgl_laohuangli_data.label1, lv_obj_get_width(lvgl_laohuangli_data.NongLi_cont));
		lv_obj_set_height(lvgl_laohuangli_data.label1, 32);
		lv_label_set_recolor(lvgl_laohuangli_data.label1, true);
		lv_label_set_align(lvgl_laohuangli_data.label1, LV_LABEL_ALIGN_CENTER);
		lv_label_set_recolor(lvgl_laohuangli_data.label1, true);
		lv_label_set_text(lvgl_laohuangli_data.label1, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label1, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_24_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label1, 20);
		//----农历----//

		//----阳历----//
		lvgl_laohuangli_data.YangLi_cont = lv_cont_create(lvgl_laohuangli_data.cont_main, NULL);
		lv_obj_set_pos(lvgl_laohuangli_data.YangLi_cont, 0, 40);
		lv_obj_set_size(lvgl_laohuangli_data.YangLi_cont, 240, 32);
		lv_obj_set_drag_parent(lvgl_laohuangli_data.YangLi_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_laohuangli_data.YangLi_cont, LV_OBJ_PART_MAIN, &lvgl_style.cont_transparent);
		lv_obj_align(lvgl_laohuangli_data.YangLi_cont, NULL, LV_ALIGN_IN_TOP_MID, 0, 35);


		lvgl_laohuangli_data.label2 = lv_label_create(lvgl_laohuangli_data.YangLi_cont, NULL);
		lv_label_set_long_mode(lvgl_laohuangli_data.label2, LV_LABEL_LONG_SROLL_CIRC);//循环滚动
		lv_obj_set_pos(lvgl_laohuangli_data.label2, 0, 0);
		lv_obj_set_width(lvgl_laohuangli_data.label2, lv_obj_get_width(lvgl_laohuangli_data.YangLi_cont));
		lv_obj_set_height(lvgl_laohuangli_data.label2, 24);
		lv_label_set_recolor(lvgl_laohuangli_data.label2, true);
		lv_label_set_align(lvgl_laohuangli_data.label2, LV_LABEL_ALIGN_CENTER);
		lv_label_set_recolor(lvgl_laohuangli_data.label2, true);
		lv_label_set_text(lvgl_laohuangli_data.label2, " ");
		lv_obj_add_style(lvgl_laohuangli_data.label2, LV_OBJ_PART_MAIN, &lvgl_style.font_changyong_16_white_bg);
		lv_label_set_anim_speed(lvgl_laohuangli_data.label2, 20);
		//----阳历----//
#if 1
#if USE_WIN
		lvgl_laohuangli_Set_WuXing("乙不栽植千株不长 酉不宴客醉坐颠狂");
		lvgl_laohuangli_Set_ChongSha("乙不栽植千株不长 酉不宴客醉坐颠狂");
		lvgl_laohuangli_Set_Yi("乙不栽植千株不长 酉不宴客醉坐颠狂");
		lvgl_laohuangli_Set_Ji("乙不栽植千株不长 酉不宴客醉坐颠狂");
		lvgl_laohuangli_Set_JiShenYiQu("乙不栽植千株不长 酉不宴客醉坐颠狂");
		lvgl_laohuangli_Set_XiongShenYiJi("乙不栽植千株不长 酉不宴客醉坐颠狂");
		lvgl_laohuangli_Set_YinLi("庚子(鼠)年九月十七");
		lvgl_laohuangli_Set_YangLi("2020-11-02");
#else
		lvgl_laohuangli_Set_WuXing(NULL);
		lvgl_laohuangli_Set_ChongSha(NULL);
		lvgl_laohuangli_Set_Yi(NULL);
		lvgl_laohuangli_Set_Ji(NULL);
		lvgl_laohuangli_Set_JiShenYiQu(NULL);
		lvgl_laohuangli_Set_XiongShenYiJi(NULL);
		lvgl_laohuangli_Set_YinLi(lvgl_globa_text[27][system_get_Language()]);
		lvgl_laohuangli_Set_YangLi(NULL);
#endif
#endif

		system_data.huoqu_laohuangli_flag = true;//更新老黄历


		lvgl_laohuangli_debug("create win");
	}
	else
	{

		lvgl_laohuangli_debug("show win");
	}

	lv_obj_set_y(lvgl_laohuangli_data.cont_main,lv_obj_get_height(lv_scr_act()));

	lv_obj_move_background(lvgl_laohuangli_data.cont_main);

	lvgl_set_obj_show(&lvgl_laohuangli_data.cont_main);

	lvgl_task_create(&lvgl_laohuangli_data.task,lvgl_laohuangli_taskcb, 1000, LV_TASK_PRIO_HIGH, NULL);
	lvgl_laohuangli_DongHua_Jin();
	lvgl_laohuangli_anim_in_start(0,0);
}


void lvgl_laohuangli_close(void)
{

	lvgl_group_remove_obj(&lvgl_laohuangli_data.cont_main);

    lvgl_task_delete(&lvgl_laohuangli_data.task);
    lvgl_task_delete(&lvgl_laohuangli_data.close_task);

    //lvgl_obj_clean(&lvgl_laohuangli_data.cont_main);
    //lvgl_obj_del(&lvgl_laohuangli_data.cont_main);

	lvgl_set_obj_hide(&lvgl_laohuangli_data.cont_main);

	lvgl_desktop_create(lv_scr_act());

}


//刷新开始
void lvgl_laohuangli_shuaXin_kaishi(void)
{
	lvgl_laohuangli_debug("刷新开始");

	lvgl_laohuangli_data.refresh_Sta = lvgl_refresh_Zhong;

	lv_obj_set_drag(lvgl_laohuangli_data.cont_main, false);//启用/禁用对象可拖动
	lvgl_laohuangli_DongHua_Chu();

	lvgl_refresh_start(&lvgl_laohuangli_data.cont_main,&system_data.huoqu_laohuangli_flag,30);


}
void lvgl_laohuangli_ShuaXin_jieshu(void)
{

	lvgl_laohuangli_debug("老黄历刷新 OK");
	lvgl_laohuangli_data.refresh_flag = false;
	lvgl_laohuangli_data.refresh_Sta = lvgl_refresh_JieShu;
	lvgl_laohuangli_DongHua_Jin();
	lvgl_laohuangli_data.roll_win_num =0;
	lvgl_laohuangli_anim_roll_win_start(0);
	lv_obj_set_drag_dir(lvgl_laohuangli_data.cont_main, LV_DRAG_DIR_ONE);//设置拖动方向
}

